From: Alex Crichton Date: Thu, 14 Apr 2016 17:40:36 +0000 (-0700) Subject: Remove submodule directory before cloning X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~14^2~43^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=bd9cf885a23c35aa4d89ed9e22f020bca4feb16e;p=cargo.git Remove submodule directory before cloning If the directory is in a corrupt state that caused an existing repository to not successfully open, then we'll want to blow it away anything that already exists to ensure we start from a clean slate. Closes #2567 --- diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index d865262d0..74ae03398 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -339,6 +339,7 @@ impl<'a> GitCheckout<'a> { } Err(..) => { let path = repo.workdir().unwrap().join(child.path()); + let _ = fs::remove_dir_all(&path); try!(git2::Repository::clone(url, &path)) } };